import React, { Component } from "react";
import { HashRouter, Switch, Route, Redirect } from "react-router-dom";
// import NavPage from './pages/NavPage';

import Loadable from "react-loadable";
const Login = Loadable({
  loader: () => import(/*webpackChunkName:'login'*/ "./pages/Login"),
  loading: () => <div>加载中......</div>,
});
const NavPage = Loadable({
  loader: () => import(/*webpackChunkName:'NavPage'*/ "./pages/NavPage"),
  loading: () => <div>加载中......</div>,
});

export default class App extends Component {
  render() {
    return (
      <HashRouter>
        <Switch>
          <Redirect from="/" exact to="/main" />
          {/* <Redirect from="/" exact to="main" /> */}
          <Route path="/login" component={Login} />
          <Route path="/main" component={NavPage} />
        </Switch>
      </HashRouter>
    );
  }
}
